<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@taglib prefix="s" uri="strutsTags"%>
<%@taglib prefix="ty" uri="/wyzzTags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<head>
	<base href="<%=basePath%>">
	<title>每月考勤历史</title>
	<jsp:include flush="true" page="/sitemesh/jsPackage.jsp"></jsp:include>
	<link href="<s:url value="/resource/css/style.css"/>" rel="stylesheet"
		type="text/css" />
	<script type='text/javascript' src='dwr/interface/DwrForAttend.js'></script>
</head>
<body onload="hrm.common.check_order();">
	<s:component template="bodyhead">
		<s:param name="pagetitle"
			value="'每月考勤历史('+startYear+'年'+startMonth+'月'+'到'+endYear+'年'+endMonth+'月)'" />
	</s:component>

	<s:form id="searchMyAttendmonthly" name="searchMyAttendmonthly"
		action="searchMyAttendmonthly" namespace="/examin" method="POST">
		<s:token />
		<input type="hidden" id="status" value="<s:property value='status'/>" />
		<s:hidden id="order" name="page.order" />
		<s:hidden id="operate" name="page.operate" />
		<s:hidden id="page.currentPage" name="page.currentPage" />
		<s:hidden id="attdEmpId" name="attdEmpId" />
		<table width="100%" class="formtable">
			<tr>
				<td align="right">
					员工:
				</td>
				<td>
					<input type="text" readonly="readonly" id="empName" name="empName"
						value="<s:property value='empName'/>" />
					<ty:auth auths="401 or 411,3 or 411,2">
						<img onclick="showChooseEmpDiv(4,1,'','empName','attdEmpId');"
							style="CURSOR: pointer" alt='点击图标选择员工' title="点击图标选择员工"
							src="resource/images/search_icon.gif" />
					</ty:auth>
				</td>
				<td align="right">
					起始年月:
				</td>
				<td>
					<s:select id="inputStartYear" name="startYear" list="years"
						emptyOption="false" />
					<s:select id="inputStartMonth" name="startMonth"
						list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
						emptyOption="false" />
				</td>
				<td>
					<label class="label">
						结束年月:
					</label>
					<s:select id="inputEndYear" name="endYear" list="years"
						emptyOption="false" />
					<s:select id="inputEndMonth" name="endMonth"
						list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
						emptyOption="false" />
				</td>
				<td align="right">
					按天/小时:
				</td>
				<td>
					<s:select id="searchMode" name="searchMode"
						list="#{0:'按天',1:'按小时'}"
						onchange="document.getElementById('order').value='';document.getElementById('searchMyAttendmonthly').submit();"></s:select>
				</td>
				<td>
					<input title="[Alt+F]" accesskey="F" name="sub_button"
						id="submit_button" class="button" type="button"
						onclick="submitSearch();" value="查询">
					<input title="[Alt+C]" accesskey="C" name="clear_button"
						class="button" type="button"
						onClick="window.location='searchMyAttendmonthly.action';"
						value="重置">
				</td>
			</tr>
		</table>

		<!-- 操作 -->
		<div class="operatediv">
			<span class="operatedivleft"> <input type="hidden"
					name="searchOrExport" id="searchOrExport" /> <s:hidden
					id="output-ommId" name="outmatchModelId" /> <s:hidden
					id="output-ioName" name="outputIoName" /> <ty:auth
					auths="401,2 or 401,3">
					<input type="hidden" id="currYear"
						value="<s:property value="currYear"/>" />
					<input class="button" id="btnOutput" type="button" value="数据导出"
						onclick="submitExport('export');" alt="右击选择导出类型" title="右击选择导出类型" />
					<input class="button" type="button" onClick="leaveTotal();"
						name="showTotal" value="年度请假汇总" />
					<input class="button" type="button" onClick="overtimeTotal();"
						name="showTotal" value="年度加班汇总" />
					<input class="button" type="button" onClick="tiaoxiuTotal();"
						name="showTotal" value="调休加班汇总" />
				</ty:auth> </span>
			<span class="operatedivright">本次查询共得到<s:property
					value="page.totalRows" />条每月考勤记录</span>
		</div>

		<div id="scrollDiv" style="overflow: scroll; width: 600;">
			<jsp:include page="search_attendmonthly_by_dayOrHour.jsp"
				flush="true"></jsp:include>
			<s:pager end="page.end" pageNo="page.currentPage"
				totalRows="page.totalRows" totalPages="page.totalPages"
				formId="searchMyAttendmonthly" start="page.start" />
		</div>
	</s:form>
	<div id="dlgExaminDetail" style="width: 750px; display: none;">
		<table id="examinDetailTable" width="100%" border="0" cellspacing="0"
			cellpadding="0" class="basictable">
			<thead>
				<tr>
					<th>
						考勤日期
					</th>
					<th>
						班次
					</th>
					<th>
						上班时间
					</th>
					<th>
						下班时间
					</th>
					<th>
						应出勤
					</th>
					<th>
						迟到(分)
					</th>
					<th>
						早退(分)
					</th>
					<th>
						缺勤
					</th>
					<th>
						请假
					</th>
					<th>
						加班(小时)
					</th>
					<th>
						异常信息
					</th>
				</tr>
			</thead>
			<tbody id="memoryDataArea">
			</tbody>
		</table>
	</div>

	<script type="text/javascript" language="javascript">
	/*****************************************************
	 * 根据屏幕大小计列表框宽度
	 * 返回值： 无
	 ******************************************************/
	function resetTableWidth() {
		var width = document.body.scrollWidth - 165;
		document.getElementById('scrollDiv').style.width = width;
	}

	//页面加载后根据用户分辨率调整表格大小
	resetTableWidth();

	//点击查询
	function submitSearch() {
		document.getElementById('searchOrExport').value = ""; //导出置空
		document.forms[0].submit();
	}

	//数据导出
	function submitExport(type) {
		document.getElementById('searchOrExport').value = type;
		document.forms[0].submit();
	}

	// 显示年度请假汇总
	function leaveTotal() {
		var attdEmpId = document.getElementById("attdEmpId").value;
		var dayOrHour = document.getElementById("searchMode").value;

		// 按天、按小时
		var unit;
		if (dayOrHour == 0)
			unit = "天";
		else
			unit = "小时";

		$("span[type='dayHourShow']").each( function() {
			$(this).html(unit);
		});

		getLeaveTotal(attdEmpId, dayOrHour, "searchMyAttendmonthly");
	}

	//显示年度加班汇总
	function overtimeTotal() {
		var attdEmpId = document.getElementById("attdEmpId").value;
		getOvertimeTotal(attdEmpId, "searchMyAttendmonthly");
	}

	// 显示调休加班使用情况
	function tiaoxiuTotal() {
		var attdEmpId = document.getElementById("attdEmpId").value;
		getTiaoxiu(attdEmpId, "searchMyAttendmonthly");
	}

	hrm.common.initDialog('dlgExaminDetail');
	hrm.common.initDialog('dlgExaminInfo');
</script>
	<%@ include file="../profile/search_emp_div.jsp"%>
	<jsp:include flush="true" page="../io/div_omm_select.jsp"></jsp:include>
	<jsp:include flush="true" page="../io/div_upload.jsp"></jsp:include>
	<jsp:include page="leaveTotal.jsp"></jsp:include>
	<jsp:include page="overtimeTotal.jsp"></jsp:include>
</body>
